import { Toast, Notify } from "vant";
import indexDB from "@/common/indexDB";
import { Http, Uploader } from "@/common/HttpClient";
import Vue from "vue";


class fileUtils {

  static singleInstance;

  static instance() {
    if (!this.singleInstance) {
      this.singleInstance = new fileUtils();
    }
    return this.singleInstance;
  }



  isExcelFile(fileName){
    if(fileName && (fileName.indexOf(".xlsx") != -1 || fileName.indexOf(".xls") != -1 ) ){
      return true;
    }else {
      return false;
    }
  }

  isWordFile(fileName){
    if(fileName && (fileName.indexOf(".docx") != -1 || fileName.indexOf(".doc") != -1 ) ){
      return true;
    }else {
      return false;
    }
  }

  isPDFFile(fileName){
    if(fileName && (fileName.indexOf(".pdf") != -1 ) ){
      return true;
    }else {
      return false;
    }
  }


  isPPTFile(fileName){
    if(fileName && (fileName.indexOf(".ppt") != -1 || fileName.indexOf(".pptx") != -1) ){
      return true;
    }else {
      return false;
    }
  }

  isTxtFile(fileName){
    if(fileName && (fileName.indexOf(".txt") != -1 ) ){
      return true;
    }else {
      return false;
    }
  }

  isPicture(fileName){
    if(fileName && (fileName.indexOf(".jpg") != -1  || fileName.indexOf(".png") != -1 ) ){
      return true;
    }else {
      return false;
    }
  }















}

export {
  fileUtils
};
